/*
 * RealGeneticAlgorithm.h
 *
 *  Created on: Oct 22, 2013
 *      Author: filipe
 */

#ifndef REALGENETICALGORITHM_H_
#define REALGENETICALGORITHM_H_

#include "GeneticAlgorithm.h"
#include "CrossoverStrategyBlend.h"
#include "MutationStrategyGaussian.h"
#include "SelectionStrategyTournament.h"
#include "RealGeneticAlgorithmAdvancedParams.h"

namespace EvolutionaryOptimization
{
	class RealGeneticAlgorithm : public EvolutionaryOptimization::GeneticAlgorithm<double>
	{
		public:

			RealGeneticAlgorithm(GeneticAlgorithmParameters *params) : GeneticAlgorithm(params)
			{
				srand(time(NULL));

				_AdvancedParams = new RealGeneticAlgorithmAdvancedParams(_Params->GetPopulationSize(), _Params->GetDimension());
			}

			RealGeneticAlgorithm(GeneticAlgorithmParameters *params, GeneticAlgorithmAdvancedParameters<double> *advanced_params) : GeneticAlgorithm(params, advanced_params)
			{
				srand(time(NULL));
			}

			virtual ~RealGeneticAlgorithm()
			{
			}

			// TODO: fazer esse metodo ser chamado no constructor
			void _GenerateInitialPopulation()
			{
				for (int i = 0; i < _Params->GetPopulationSize(); i++)
				{
					for (int j = 0; j < _Params->GetDimension(); j++)
					{
						_Population[i][j] = (double) rand();
					}

					_CheckBoundaries(_Population[i]);
				}
			}
	};
}

#endif
